/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class CreatePinPassData {
	public void createTestData() throws PersistentException {
		PersistentTransaction t = orm.PinPassPersistentManager.instance().getSession().beginTransaction();
		try {
			orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
			orm.dao.TarjetaDAO oRMTarjetaDAO = lDAOFactory.getTarjetaDAO();
			orm.Tarjeta oRMTarjeta = oRMTarjetaDAO.createTarjeta();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : cliente, codigo
			oRMTarjetaDAO.save(oRMTarjeta);
			orm.dao.ClienteDAO oRMClienteDAO = lDAOFactory.getClienteDAO();
			orm.Cliente oRMCliente = oRMClienteDAO.createCliente();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tarjeta, rut, nombre
			oRMClienteDAO.save(oRMCliente);
			orm.dao.CoordenadaDAO oRMCoordenadaDAO = lDAOFactory.getCoordenadaDAO();
			orm.Coordenada oRMCoordenada = oRMCoordenadaDAO.createCoordenada();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : valor, nombre
			oRMCoordenadaDAO.save(oRMCoordenada);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			CreatePinPassData createPinPassData = new CreatePinPassData();
			try {
				createPinPassData.createTestData();
			}
			finally {
				orm.PinPassPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
